package com.jvtd.nettyim.im.codec;

import com.jvtd.nettyim.im.protocol.Packet;
import com.jvtd.nettyim.im.protocol.PacketCode;
import io.netty.buffer.ByteBuf;
import io.netty.channel.ChannelHandlerContext;
import io.netty.handler.codec.MessageToByteEncoder;

/**
 * @author Created by neal.zhang
 * @date 2020/5/29 - 18:17
 */
public class PacketEncoder extends MessageToByteEncoder<Packet> {

    @Override
    protected void encode(ChannelHandlerContext ctx, Packet packet, ByteBuf out) throws Exception {
        PacketCode.INSTANCE.encode(packet,out);
    }
}
